Skip to content

v0.6.29: login improvements, posthog telemetry#4026

Merged
TheodoreSpeaks merged 2 commits intomainfrom
staging
Apr 7, 2026
Merged

v0.6.29: login improvements, posthog telemetry#4026
TheodoreSpeaks merged 2 commits intomainfrom
staging

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

TheodoreSpeaks and others added 2 commits April 7, 2026 18:30
Co-authored-by: Theodore Li <theo@sim.ai>
* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha

---------

Co-authored-by: Theodore Li <theo@sim.ai>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 7, 2026 10:50pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 7, 2026

PR Summary

Medium Risk
Touches signup request configuration (captcha header propagation) and chat stop-generation handlers; mistakes could block account creation or misfire cancellation behavior, but changes are small and localized.

Overview
Fixes captcha header propagation during email signup by sending x-captcha-response via the correct request options shape in client.signUp.email, and simplifies the "user already exists" error handling message.

Adds PostHog telemetry for aborted generation by introducing a new task_generation_aborted event and emitting it when users stop generation in both the mothership home chat and the workflow copilot chat (with a view dimension).

Reviewed by Cursor Bugbot for commit 0f602f7. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 7, 2026

Greptile Summary

This PR bundles two focused changes: (1) PostHog telemetry for mothership/copilot generation abort (task_generation_aborted) and message send (task_message_sent), and (2) a fix for Turnstile captcha token not being forwarded as an x-captcha-response header on manual signup.

  • events.ts: Adds two well-typed event definitions to the PostHog catalog — schemas match all call sites exactly.
  • home.tsx: Uses the posthogRef pattern correctly to avoid stale closures in useCallback. Captures task_generation_aborted on stop and task_message_sent on submit.
  • panel.tsx: Mirrors the posthogRef pattern and adds task_generation_aborted for the copilot view, but handleCopilotSubmit does not capture task_message_sent, making copilot sends invisible in analytics while mothership sends are tracked.
  • signup-form.tsx: The captcha fix correctly makes the x-captcha-response header conditional on the token existing. Error handling and setIsLoading resets are all properly covered.

Confidence Score: 5/5

Safe to merge — all remaining findings are P2 style/analytics consistency suggestions with no correctness or data integrity impact.

Both commits are small and focused. The captcha fix is correct and straightforward. The telemetry additions follow the existing posthogRef pattern properly. The only gap is a missing task_message_sent event in the copilot submit handler, which is a non-blocking analytics omission.

panel.tsx — the missing task_message_sent capture in handleCopilotSubmit should be addressed for complete telemetry parity.

Vulnerabilities

No security concerns identified. The captcha token is forwarded as a request header only when present and is not logged or stored client-side.

Important Files Changed

Filename Overview
apps/sim/lib/posthog/events.ts Adds two new well-typed event entries (task_generation_aborted, task_message_sent) — schemas match all call sites exactly
apps/sim/app/workspace/[workspaceId]/home/home.tsx Adds posthogRef to avoid stale closures, tracks abort and message-send events correctly in mothership view
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx Adds abort telemetry for copilot view; missing task_message_sent capture in handleCopilotSubmit creates inconsistent analytics coverage vs mothership
apps/sim/app/(auth)/signup/signup-form.tsx Fixes captcha token forwarding — correctly gates x-captcha-response header on token presence; all error branches and loading state resets are intact

Sequence Diagram

sequenceDiagram
    participant U as User
    participant Home as Home (Mothership)
    participant Panel as Panel (Copilot)
    participant PH as PostHog
    participant API as Chat API

    U->>Home: Submit message
    Home->>PH: task_message_sent {view: mothership}
    Home->>API: sendMessage()

    U->>Home: Click Stop
    Home->>PH: task_generation_aborted {view: mothership}
    Home->>API: stopGeneration()

    U->>Panel: Submit message
    Note over Panel,PH: ⚠ task_message_sent NOT captured
    Panel->>API: copilotSendMessage()

    U->>Panel: Click Stop
    Panel->>PH: task_generation_aborted {view: copilot}
    Panel->>API: copilotStopGeneration()

    U->>Home: Sign up (with captcha)
    Home->>Home: widget.execute() gets token
    Home->>API: signUp.email() + x-captcha-response header
Loading

Comments Outside Diff (1)

  1. apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx, line 414-421 (link)

    P2 Missing task_message_sent telemetry in copilot submit

    handleCopilotSubmit sends a message without capturing the task_message_sent event, while the equivalent handleSubmit in home.tsx (line 239) does capture it. This creates an incomplete analytics picture — copilot message sends won't appear in PostHog alongside mothership sends.

    Consider adding the capture here for parity:

Reviews (1): Last reviewed commit: "fix(login): fix captcha headers for manu..." | Re-trigger Greptile

@TheodoreSpeaks TheodoreSpeaks merged commit d6ec115 into main Apr 7, 2026
26 of 27 checks passed
waleedlatif1 pushed a commit that referenced this pull request Apr 14, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
Sg312 added a commit that referenced this pull request Apr 14, 2026
* v0.6.29: login improvements, posthog telemetry (#4026)

* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha

* fix build error

* improvement(mothership): new agent loop (#3920)

* feat(transport): replace shared chat transport with mothership-stream module

* improvement(contracts): regenerate contracts from go

* feat(tools): add tool catalog codegen from go tool contracts

* feat(tools): add tool-executor dispatch framework for sim side tool routing

* feat(orchestrator): rewrite tool dispatch with catalog-driven executor and simplified resume loop

* feat(orchestrator): checkpoint resume flow

* refactor(copilot): consolidate orchestrator into request/ layer

* refactor(mothership): reorganize lib/copilot into structured subdirectories

* refactor(mothership): canonical transcript layer, dead code cleanup, type consolidation

* refactor(mothership): rebase onto latest staging

* refactor(mothership): rename request continue to lifecycle

* feat(trace): add initial version of request traces

* improvement(stream): batch stream from redis

* fix(resume): fix the resume checkpoint

* fix(resume): fix resume client tool

* fix(subagents): subagent resume should join on existing subagent text block

* improvement(reconnect): harden reconnect logic

* fix(superagent): fix superagent integration tools

* improvement(stream): improve stream perf

* Rebase with origin dev

* fix(tests): fix failing test

* fix(build): fix type errors

* fix(build): fix build errors

* fix(build): fix type errors

* feat(mothership): add cli execution

* fix(mothership): fix function execute tests

* Force redeploy

* feat(motheship): add docx support

* feat(mothership): append

* Add deps

* improvement(mothership): docs

* File types

* Add client retry logic

* Fix stream reconnect

* Eager tool streaming

* Fix client side tools

* Security

* Fix shell var injection

* Remove auto injected tasks

* Fix 10mb tool response limit

* Fix trailing leak

* Remove dead tools

* file/folder tools

* Folder tools

* Hide function code inline

* Dont show internal tool result reads

* Fix spacing

* Auth vfs

* Empty folders should show in vfs

* Fix run workflow

* change to node runtime

* revert back to bun runtime

* Fix

* Appends

* Remove debug logs

* Patch

* Fix patch tool

* Temp

* Checkpoint

* File writes

* Fix

* Remove tool truncation limits

* Bad hook

* replace react markdown with streamdown

* Checkpoitn

* fix code block

* fix stream persistence

* temp

* Fix file tools

* tool joining

* cleanup subagent + streaming issues

* streamed text change

* Tool display intetns

* Fix dev

* Fix tests

* Fix dev

* Speed up dev ci

* Add req id

* Fix persistence

* Tool call names

* fix payload accesses

* Fix name

* fix snapshot crash bug

* fix

* Fix

* remove worker code

* Clickable resources

* Options ordering

* Folder vfs

* Restore and mass delete tools

* Fix

* lint

* Update request tracing and skills and handlers

* Fix editable

* fix type error

* Html code

* fix(chat): make inline code inherit parent font size in markdown headers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* improved autolayout

* durable stream for files

* one more fix

* POSSIBLE BREAKAGE: SCROLLING

* Fixes

* Fixes

* Lint fix

* fix(resource): fix resource view disappearing on ats (#4103)

Co-authored-by: Theodore Li <theo@sim.ai>

* Fixes

* feat(mothership): add execution logs as a resource type

Adds `log` as a first-class mothership resource type so copilot can open
and display workflow execution logs as tabs alongside workflows, tables,
files, and knowledge bases.

- Add `log` to MothershipResourceType, all Zod enums, and VALID_RESOURCE_TYPES
- Register log in RESOURCE_REGISTRY (Library icon) and RESOURCE_INVALIDATORS
- Add EmbeddedLog and EmbeddedLogActions components in resource-content
- Export WorkflowOutputSection from log-details for reuse in EmbeddedLog
- Add log resolution branch in open_resource handler via new getLogById service
- Include log id in get_workflow_logs response and extract resources from output
- Exclude log from manual add-resource dropdown (enters via copilot tools only)
- Regenerate copilot contracts after adding log to open_resource Go enum

* Fix perf and message queueing

* Fix abort

* fix(ui): dont delete resource on clearing from context, set resource closed on new task (#4113)

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement(mothership): structure sim side typing

* address comments

* reactive text editor tweaks

* Fix file read and tool call name persistence bug

* Fix code stream + create file opening resource

* fix use chat race + headless trace issues

* Fix type issue

* Fix mothership block req lifecycle

* Fix build

* Move copy reqid

* Fix

* fix(ui): fix resource tag transition from home to task (#4132)

Co-authored-by: Theodore Li <theo@sim.ai>

* Fix persistence

* Clean code, fix bugs

* Fix

* Fixes

---------

Co-authored-by: Waleed <walif6@gmail.com>
Co-authored-by: Theodore Li <theodoreqili@gmail.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Theodore Li <theo@sim.ai>
waleedlatif1 pushed a commit that referenced this pull request Apr 15, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
waleedlatif1 added a commit that referenced this pull request Apr 15, 2026
* v0.6.29: login improvements, posthog telemetry (#4026)

* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha

* improvement(ui): rename user-facing "execution" to "run"

* fix(mothership): remove duplicate handleStopGeneration declaration

* chore: remove verbose comment in cancel route

* fix(ui): missed execution → run renames in search suggestions and error fallback

---------

Co-authored-by: Theodore Li <theodoreqili@gmail.com>
waleedlatif1 pushed a commit that referenced this pull request Apr 15, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
waleedlatif1 added a commit that referenced this pull request Apr 15, 2026
* v0.6.29: login improvements, posthog telemetry (#4026)

* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha

* fix(landing): return 404 for invalid dynamic route slugs

Add `dynamicParams = false` to all landing page dynamic routes so
Next.js returns a proper 404 instead of a client-side exception for
slugs not in generateStaticParams.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(home): remove duplicate handleStopGeneration declaration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Theodore Li <theodoreqili@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
waleedlatif1 pushed a commit that referenced this pull request Apr 15, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
waleedlatif1 added a commit that referenced this pull request Apr 15, 2026
…4184)

* v0.6.29: login improvements, posthog telemetry (#4026)

* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha

* fix(gemini): support structured output with tools on Gemini 3 models

* fix(home): remove duplicate handleStopGeneration declaration

* refactor(gemini): use prefix-based Gemini 3 model detection

---------

Co-authored-by: Theodore Li <theodoreqili@gmail.com>
waleedlatif1 pushed a commit that referenced this pull request Apr 16, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
waleedlatif1 added a commit that referenced this pull request Apr 16, 2026
…se cleanup (#4196)

* v0.6.29: login improvements, posthog telemetry (#4026)

* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha

* fix(ui): posthog guard, dynamic import loading, compact variant, rebase cleanup

---------

Co-authored-by: Theodore Li <theodoreqili@gmail.com>
waleedlatif1 pushed a commit that referenced this pull request Apr 16, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
waleedlatif1 pushed a commit that referenced this pull request Apr 16, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
waleedlatif1 pushed a commit that referenced this pull request Apr 17, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
waleedlatif1 pushed a commit that referenced this pull request Apr 17, 2026
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant